package com.chengdu.third.dao;

import com.chengdu.third.pojo.Basic;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface IBasicDao {

    /**
     * 查找所有
     * @return
     */
    @Select("select * from basic")
    public List<Basic> find();

    /**
     * 根据id删除
     * @param id
     */
    @Delete("delete from basic where id  = #{id}")
    public void delete(long id);

    /**
     * 根据id修改
     * @param
     */
    @Update("update basic set Area_prefectures = #{Area_prefectures},Area_town = #{Area_town},Area_village = #{Area_village},context = #{context} where id = #{id}")
    public void update(String Area_prefectures,String Area_town,String Area_village,String context,long id);

    /**
     * 增加
     * @param
     */
    @Insert("insert into  basic(`Area_prefectures`,`Area_town`,`Area_village`,`context`,`Reviw_units`) values(#{Area_prefectures},#{Area_town},#{Area_village},#{context},#{Reviw_units})")
    public void add(String Area_prefectures,String Area_town,String Area_village,String context,String Reviw_units);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Select("select * from basic where id = #{id}")
    public Basic getBasicById(long id);
}
